/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ipfms.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 *
 * @author haqqiem
 */
@Entity
@Table(name = "faulty_report")
//@NamedQueries({
//    @NamedQuery(name = "FaultyReport.findAll", query = "SELECT f FROM FaultyReport f"),
//    @NamedQuery(name = "FaultyReport.findByIdReport", query = "SELECT f FROM FaultyReport f WHERE f.idReport = :idReport"),
//    @NamedQuery(name = "FaultyReport.findByBuildingId", query = "SELECT f FROM FaultyReport f WHERE f.buildingId = :buildingId"),
//    @NamedQuery(name = "FaultyReport.findByRemarks", query = "SELECT f FROM FaultyReport f WHERE f.remarks = :remarks"),
//    @NamedQuery(name = "FaultyReport.findByUserCreated", query = "SELECT f FROM FaultyReport f WHERE f.userCreated = :userCreated"),
//    @NamedQuery(name = "FaultyReport.findByDateCreated", query = "SELECT f FROM FaultyReport f WHERE f.dateCreated = :dateCreated"),
//    @NamedQuery(name = "FaultyReport.findByUserModified", query = "SELECT f FROM FaultyReport f WHERE f.userModified = :userModified"),
//    @NamedQuery(name = "FaultyReport.findByDateModified", query = "SELECT f FROM FaultyReport f WHERE f.dateModified = :dateModified")})
public class FaultyReport implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_report")
    private Integer idReport;

    @ManyToOne (fetch = FetchType.LAZY)
    @JoinColumn(name = "building_id")
    private Building building;

    @Column(name = "remarks")
    private String remarks;

    @Column(name = "current_action")
    private String action;

    @Column(name = "status")
    private Character status;

    @ManyToOne (fetch = FetchType.LAZY)
    @JoinColumn(name = "code_classification")
    private CodeClassification code;

    @ManyToOne (fetch = FetchType.LAZY)
    @JoinColumn(name = "code_maintenance")
    private CodeMaintenance maintenance;

    @Embedded
    private InfoAudit infoAudit;

    public FaultyReport() {
    }

    public FaultyReport(Integer idReport) {
        this.idReport = idReport;
    }

    public FaultyReport(Integer idReport, Character status) {
        this.idReport = idReport;
        this.status = status;
    }

    public Integer getIdReport() {
        return idReport;
    }

    public void setIdReport(Integer idReport) {
        this.idReport = idReport;
    }

    public Building getBuilding() {
        return building;
    }

    public void setBuilding(Building building) {
        this.building = building;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public InfoAudit getInfoAudit() {
        return infoAudit;
    }

    public void setInfoAudit(InfoAudit infoAudit) {
        this.infoAudit = infoAudit;
    }

    public Character getStatus() {
        return status;
    }

    public void setStatus(Character status) {
        this.status = status;
    }

    public CodeClassification getCode() {
        return code;
    }

    public void setCode(CodeClassification code) {
        this.code = code;
    }

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public CodeMaintenance getMaintenance() {
        return maintenance;
    }

    public void setMaintenance(CodeMaintenance maintenance) {
        this.maintenance = maintenance;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idReport != null ? idReport.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FaultyReport)) {
            return false;
        }
        FaultyReport other = (FaultyReport) object;
        if ((this.idReport == null && other.idReport != null) || (this.idReport != null && !this.idReport.equals(other.idReport))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ipfms.model.FaultyReport[idReport=" + idReport + "]";
    }

}
